<template>
  <div class="users">
    <ul>
      <li v-for="m in msg"
          v-on:click="m.show=!m.show">
        <h2>{{m.name}}</h2>
        <h3 v-show="m.show">{{m.desc}}</h3>
      </li>
    </ul>
    <botton v-on:click="deleteMsg">删除</botton>
  </div>
</template>

<script type="text/ecmascript-6">
  export default {
    name: 'users',
    //props:["msg"],这种写法不是很好
    props:{
      msg:{
        type:Array,
        required:true
      }
    },
    data() {
      return {

        info: 'Users.vue------->'
      }
    },
    methods:{
      deleteMsg:function(){
        this.msg.pop();
      }
    }
  }
</script>

<style scoped>
  .users {
    width: 100%;
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    box-sizing: border-box;
  }

  ul {
    display: flex;/*弹性布局*/
    flex-wrap: wrap;
    list-style-type: none;
    padding: 0;
  }

  li {
    flex-grow: 1;/*放大的比例默认是0，*/
    flex-basis: 120px;
    text-align: center;
    padding: 30px;
    border: 1px solid #222;
    margin: 10px;
  }

</style>

